using System;
using Microsoft.TeamFoundation.Server;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Microsoft.Services.TfsAlert.TfsAlertScenarioTests.NotificationRecieverProxy;

namespace Microsoft.Services.TfsAlert.TfsAlertScenarioTests
{
    [TestClass]
    public class NotificationReciever_ws
    {
        [TestMethod]
        public void CanCallNotificationRecieverViaGeneratedWSProxyCall()
        {
            NotificationReciever notificationReciever = new NotificationReciever();
            notificationReciever.Url = @"http://localhost:9999/TFSAlert";

            SubscriptionInfo subscriptionInfo = new SubscriptionInfo();
            subscriptionInfo.ID = 123;
            subscriptionInfo.Subscriber = "asdfasdfasdf";

            notificationReciever.Notify(
                @"<?xml version='1.0' encoding='utf-16'?><WorkItemChangedEvent xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'><PortfolioProject>Test</PortfolioProject><ProjectNodeId>0d79a168-0c51-4a94-9b11-93793c4de1a9</ProjectNodeId><AreaPath>\Test</AreaPath><Title>Test Work Item Changed: Task 31 - Notification Test</Title><WorkItemTitle>Notification Test</WorkItemTitle><Subscriber>HQ\csell5</Subscriber><ChangerSid>S-1-5-21-1531756644-728367025-3139653518-1106</ChangerSid><DisplayUrl>http://websvr:8080/WorkItemTracking/WorkItem.aspx?artifactMoniker=31</DisplayUrl><TimeZone>Central Standard Time</TimeZone><TimeZoneOffset>-06:00:00</TimeZoneOffset><ChangeType>Change</ChangeType><CoreFields><IntegerFields><Field><Name>ID</Name><ReferenceName>System.Id</ReferenceName><OldValue>31</OldValue><NewValue>31</NewValue></Field><Field><Name>Rev</Name><ReferenceName>System.Rev</ReferenceName><OldValue>6</OldValue><NewValue>7</NewValue></Field><Field><Name>AreaID</Name><ReferenceName>System.AreaId</ReferenceName><OldValue>1</OldValue><NewValue>1</NewValue></Field></IntegerFields><StringFields><Field><Name>Work Item Type</Name><ReferenceName>System.WorkItemType</ReferenceName><OldValue>Task</OldValue><NewValue>Task</NewValue></Field><Field><Name>Title</Name><ReferenceName>System.Title</ReferenceName><OldValue>Notification Test</OldValue><NewValue>Notification Test</NewValue></Field><Field><Name>Area Path</Name><ReferenceName>System.AreaPath</ReferenceName><OldValue>\Test</OldValue><NewValue>\Test</NewValue></Field><Field><Name>State</Name><ReferenceName>System.State</ReferenceName><OldValue>Active</OldValue><NewValue>Active</NewValue></Field><Field><Name>Reason</Name><ReferenceName>System.Reason</ReferenceName><OldValue>New</OldValue><NewValue>New</NewValue></Field><Field><Name>Assigned To</Name><ReferenceName>System.AssignedTo</ReferenceName><OldValue>Clark P. Sell</OldValue><NewValue>Clark P. Sell</NewValue></Field><Field><Name>Changed By</Name><ReferenceName>System.ChangedBy</ReferenceName><OldValue>Clark P. Sell</OldValue><NewValue>Clark P. Sell</NewValue></Field><Field><Name>Created By</Name><ReferenceName>System.CreatedBy</ReferenceName><OldValue>Clark P. Sell</OldValue><NewValue>Clark P. Sell</NewValue></Field><Field><Name>Changed Date</Name><ReferenceName>System.ChangedDate</ReferenceName><OldValue>2/10/2006 1:03:13 PM</OldValue><NewValue>2/10/2006 1:06:29 PM</NewValue></Field><Field><Name>Created Date</Name><ReferenceName>System.CreatedDate</ReferenceName><OldValue>2/10/2006 9:16:42 AM</OldValue><NewValue>2/10/2006 9:16:42 AM</NewValue></Field><Field><Name>Authorized As</Name><ReferenceName>System.AuthorizedAs</ReferenceName><OldValue>Clark P. Sell</OldValue><NewValue>Clark P. Sell</NewValue></Field><Field><Name>Iteration Path</Name><ReferenceName>System.IterationPath</ReferenceName><OldValue>\Test</OldValue><NewValue>\Test</NewValue></Field></StringFields></CoreFields><TextFields><TextField><Name>Description</Name><ReferenceName>System.Description</ReferenceName><Value>CLARKSELL</Value></TextField></TextFields><ChangedFields><IntegerFields /><StringFields /></ChangedFields></WorkItemChangedEvent>",
                "tfsIdentityXML",
                subscriptionInfo);
            
        }
    }
}
